@extends('layouts.default') @section('main')
    <link rel="stylesheet" href="/css/uniform.css" />
    <link rel="stylesheet" href="/css/select2.css" />
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb"> <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i class="icon-home"></i> 首页</a> <a href="#" class="current">系统参数管理</a> </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    @if(in_array('add',$actions))<a href="{{url('settings/create')}}"></a>@endif
                        <form action="{{url('setting/search')}}">
                            <table>
                                <tr>
                                    <td></td>
                                </tr>
                                <th><input type="hidden" name="_token" value="{{csrf_token()}}"></th>
                            </table>
                        </form>



                </div>
            </div>
        </div>
    </div>
    <div>
        <div id="myAlert" class="modal hide">
            <div class="modal-header">
                <button data-dismiss="modal" class="close" type="button">×</button>
                <h3>提示</h3>
            </div>
            <div class="modal-body">
                <p>确认删除这条数据吗？</p>
            </div>
            <div class="modal-footer">
                <a data-dismiss="modal" class="btn btn-primary" href="javascript:void(0);">确定</a>
                <a data-dismiss="modal" class="btn" href="javascript:void(0);">取消</a>
            </div>
        </div>
        <form action="{{url('setting/delete')}}" method="post"
              id="settingForm">
            <input type="hidden" name="sid" value="0">
        </form>
        @foreach($lists as $k=>$v)
            <tr>
                <td>{{$v->name}}</td>
                <td>{{$v->variable}}</td>
                <td>{{$v->value}}</td>
                <td>{{$v->sort}}</td>
                <td>@if($v->system==1)<i class="icon-ok"></i>@elseif($c->system==0)<i class="glyphicon-record"></i>@endif</td>
                <td>
                    @if(in_array('edit',$actions))<a data-original-title="编辑" class="tip" href="{{url('setting/edit?id'.$v->id)}}"></a>@endif
                    @if(in_array('delete',$actions))@endif
                </td>
            </tr>
            @endforeach
        <button type="submit" class="btn btn-info">查询</button>
        <?php echo $lists->render();?>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/matrix.tables.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(".setting_delete").click(function(){
           var setting_id=$(this).attr('setting_id');
            $("input[name='sid']").val(setting_id);
        });
        $(".btn-primary").click(function(){
            var setting_id = $("input[name='sid']").val();
            if(setting_id == 0){
                alert('参数异常');
                return ;
            }
            ajaxRequest($('#settingForm').serializeArray(),$('#settingForm').attr('action'),function(data){
                if(data.staus){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
